package com.kele.single;

/**
 * @author kele
 * @date 2021/10/13 15:59
 * @description
 * 静态内部类的单例模式
 */
public class StaticInnerSingle {

    private StaticInnerSingle(){

    }

    public static StaticInnerSingle getInstance(){
        return InnerClass.SINGLE;
    }
       public static class InnerClass{
        private static final StaticInnerSingle SINGLE=new StaticInnerSingle();
    }

    public static void main(String[] args) {
        StaticInnerSingle staticInnerSingle1=StaticInnerSingle.getInstance();
        StaticInnerSingle staticInnerSingle2=StaticInnerSingle.getInstance();

        System.out.println(staticInnerSingle1==staticInnerSingle2);
    }
}
